package chamber.zero.file;

import com.google.common.io.InputSupplier;
import com.google.common.io.OutputSupplier;
import com.google.inject.Inject;

import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

/**
 * Created by Gerardo on 12/2/13.
 */
public class TextFileImpl implements TextFile {
    private final InputSupplier<InputStreamReader> inputSupplier;
    private final OutputSupplier<OutputStreamWriter> outputSupplier;

    @Inject
    public TextFileImpl(final InputSupplier<InputStreamReader> inputSupplier, final OutputSupplier<OutputStreamWriter> outputSupplier) {
        this.inputSupplier = inputSupplier;
        this.outputSupplier = outputSupplier;
    }

    @Override
    public InputStreamReader getInput() throws IOException {
        return inputSupplier.getInput();
    }

    @Override
    public OutputStreamWriter getOutput() throws IOException {
        return outputSupplier.getOutput();
    }
}
